//单例饿汉模式安全版本
class mySingletonLazy{
    private static final Object locker = new Object();
    private volatile static mySingletonLazy instance;
    public static mySingletonLazy getInstance() {
        if (instance == null) {
            synchronized (locker) {
                if (instance == null) {
                    instance = new mySingletonLazy();
                }
            }
        }
        return instance;
    }
    private mySingletonLazy(){};
}
public class Demo1 {
    public static void main(String[] args) {
        mySingletonLazy.getInstance();
        System.out.println(mySingletonLazy.getInstance());
        System.out.println(mySingletonLazy.getInstance());
        System.out.println(mySingletonLazy.getInstance());
    }
}
